//
//  YZLCarImageCollectionViewCell.m
//  Car
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLCarImageCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@interface YZLCarImageCollectionViewCell ()

@property (nonatomic, strong) UIImageView *smallImage;

@end

@implementation YZLCarImageCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        self.smallImage = [[UIImageView alloc] init];
        self.smallImage.backgroundColor = [UIColor colorWithWhite:0.700 alpha:1.000];
        [self.contentView addSubview:self.smallImage];
        
    }
    
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    
    self.smallImage.frame = self.contentView.frame;
}

- (void)setImageModel:(YZLCarImageModel *)imageModel {
    
    if (_imageModel != imageModel) {
        _imageModel = imageModel;
    }
    NSDictionary *dic = [self.imageModel.imagesList objectAtIndex:self.num];
    [self.smallImage sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"imageSrc"]] placeholderImage:[UIImage imageNamed:@"D0"]];
}

@end
